<extend name="Layout:layout"/>

<block name="css">
	<link rel="stylesheet" href=""></block>

<block name="srcjs">
	<script type="text/javascript" src=""></script>
</block>

<block name="content">

	<h1>新用户注册</h1>
	<hr>

	<form class="form-horizontal" role="form" id="addUserForm" method="post">

		<div class="form-group">
			<label for="username" class="col-sm-2 control-label">注册户名</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" id="username" name="username" required="required"></div>
		</div>

		<div class="form-group">
			<label for="password" class="col-sm-2 control-label">密码</label>
			<div class="col-sm-8">
				<input type="password" class="form-control" id="password" name="password" required="required"></div>
		</div>

		<div class="form-group">
			<label for="confirmPassword" class="col-sm-2 control-label">确认密码</label>
			<div class="col-sm-8">
				<input type="password" class="form-control" id="confirmPassword" name="confirmPassword" required="required"></div>
		</div>

		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<button type="submit" id="btnSubmitAddUser" class="btn btn-info">保存</button>
			</div>
		</div>
	</form>

	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>

	<br></block>

<block name="customjs">

	<script type="text/javascript">
	$(function(){
		$("#addUserForm").submit(function(){
			var password = $("#password").val();
			var confirmPassword = $("#confirmPassword").val();

			if(!password){
				alert("请输入密码");
				return;
			}

			if( password != confirmPassword){
				alert("密码不一致！");
				return;
			}

			var sendData = $("#addUserForm").serialize();
			$.post("{:U('addUser')}", sendData).done(function(responseData){
				if(responseData.status == 1){
					alert(responseData.info);
					location.href = responseData.jumpUrl;
				}else{
					alert(responseData.info);
				}
			});

			return false;

		});
	});
	</script>

</block>